<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page import="sfmc.biz.vo.Sfmc_TB_OPTION"%>
<%@ page import="java.util.List"%>
<%
Sfmc_TB_OPTION sfmc_TB_OPTION = ((List<Sfmc_TB_OPTION>)request.getAttribute("optionlist")).get(0);
%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8" />
<meta http-equiv="Cache-Control" content="No-Cache" />
<meta http-equiv="Pragma" content="No-Cache" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>근무시간 설정</title>
<link rel="stylesheet" type="text/css" href="/resources/theme/metro-blue/easyui.css" />
<link rel="stylesheet" type="text/css" href="/resources/theme/icon.css" />
<link rel="stylesheet" type="text/css" href="/resources/css/ui_custom.css" />
<link rel="stylesheet" type="text/css" href="/resources/css/design.css" />
<link rel="stylesheet" type="text/css" href="/resources/css/form.css" />
<!--[if lt IE 9]>
	<script type="text/javascript" src="/resources/js/html5.js" /></script>
<![endif]-->
<script type="text/javascript" src="/resources/js/jquery-1.9.1.js" /></script>
<script type="text/javascript" src="/resources/js/jquery.easyui.all.js" /></script>
<script type="text/javascript" src="/resources/js/jquery.jclock.js" /></script>
<script type="text/javascript" src="/resources/js/common.js" /></script>

<script type="text/javascript" language="javascript">

function saveData(){
	document.form.startTime.value = document.form.startTime1.value + document.form.startTime2.value;
	document.form.endTime.value = document.form.endTime1.value + document.form.endTime2.value;
	document.form.target = "behindFrame";
	document.form.action="/option_save.do";
	document.form.submit();
}

function reload(returnVal, type){

	if(returnVal==-1){
		switch(type){
		case "C": 
			alert("저장중 에러가 발생 하였습니다.");
			break;
		case "U": 
			alert("수정중 에러가 발생 하였습니다.");
			break;
		case "D": 
			alert("삭제중 에러가 발생 하였습니다.");
			break;
		}
	}else{
		switch(type){
		case "C": 
			alert("저장되었습니다.");
			break;
		case "U": 
			alert("수정되었습니다.");
			break;
		case "D": 
			alert("삭제되었습니다.");
			break;
		}
		
		document.form.target = "_self";
		document.form.action="/option_list.do";
		document.form.submit();	
	}
}

</script>
</head>
	
<body class="pop easyui-layout">
<form method="POST" name="form">
<iframe id="behindFrame" name="behindFrame"></iframe>
	<input type="hidden" name="startTime" value=""/>
	<input type="hidden" name="endTime" value=""/>
	<div data-options="region:'center',border:false,iconCls:'icon-head02',title:'근무시간 설정'" class="padding10">
	
		<h2>근무시간</h2>		
		<div class="wrap_tbl_inner marginT5 marginB10">	
			<table class="tbl_inner" name = "tboption">	
				<colgroup>
					<col width="85px">
					<col>
				</colgroup>
				<tr>
					<td colspan="2">
						<input type="checkbox"  name="checkHolyday" value = "1" <%=sfmc_TB_OPTION.getCheckHolyday().equals("1")?"checked":""%>>휴일 설정<br />
						<input type="checkbox" name="checkWorktime" value = "1" <%=sfmc_TB_OPTION.getCheckWorktime().equals("1")?"checked":""%>>근무시간 설정
					</td>
				</tr>
				<tr>
					<th>평일 근무시작</th>
					<td>
						<select class="autoW" name="startTime1">
							<option value="00" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("00")?" selected":""%>>00</option>
							<option value="01" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("01")?" selected":""%>>01</option>
							<option value="02" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("02")?" selected":""%>>02</option>
							<option value="03" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("03")?" selected":""%>>03</option>
							<option value="04" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("04")?" selected":""%>>04</option>
							<option value="05" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("05")?" selected":""%>>05</option>
							<option value="06" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("06")?" selected":""%>>06</option>
							<option value="07" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("07")?" selected":""%>>07</option>
							<option value="08" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("08")?" selected":""%>>08</option>
							<option value="08" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("09")?" selected":""%>>09</option>
							<option value="10" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("10")?" selected":""%>>10</option>
							<option value="11" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("11")?" selected":""%>>11</option>
							<option value="12" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("12")?" selected":""%>>12</option>
							<option value="13" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("13")?" selected":""%>>13</option>
							<option value="14" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("14")?" selected":""%>>14</option>
							<option value="15" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("15")?" selected":""%>>15</option>
							<option value="16" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("16")?" selected":""%>>16</option>
							<option value="17" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("17")?" selected":""%>>17</option>
							<option value="18" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("18")?" selected":""%>>18</option>
							<option value="19" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("19")?" selected":""%>>19</option>
							<option value="20" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("20")?" selected":""%>>20</option>
							<option value="21" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("21")?" selected":""%>>21</option>
							<option value="22" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("22")?" selected":""%>>22</option>
							<option value="23" <%=sfmc_TB_OPTION.getStartTime().substring(0, 2).equals("23")?" selected":""%>>23</option>
						</select>시
						<select class="autoW" name="startTime2">
							<option value="00" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("00")?" selected":""%>>00</option>
							<option value="05" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("05")?" selected":""%>>05</option>
							<option value="10" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("10")?" selected":""%>>10</option>
							<option value="15" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("15")?" selected":""%>>15</option>
							<option value="20" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("20")?" selected":""%>>20</option>
							<option value="25" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("25")?" selected":""%>>25</option>
							<option value="30" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("30")?" selected":""%>>30</option>
							<option value="35" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("35")?" selected":""%>>35</option>
							<option value="40" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("40")?" selected":""%>>40</option>
							<option value="45" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("45")?" selected":""%>>45</option>
							<option value="50" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("50")?" selected":""%>>50</option>
							<option value="55" <%=sfmc_TB_OPTION.getStartTime().substring(2, 4).equals("55")?" selected":""%>>55</option>
						</select>분
					</td>
				</tr>
				<tr>
					<th>평일 근무종료</th>
					<td>
						<select class="autoW" name="endTime1">
							<option value="00" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("00")?" selected":""%>>00</option>
							<option value="01" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("01")?" selected":""%>>01</option>
							<option value="02" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("02")?" selected":""%>>02</option>
							<option value="03" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("03")?" selected":""%>>03</option>
							<option value="04" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("04")?" selected":""%>>04</option>
							<option value="05" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("05")?" selected":""%>>05</option>
							<option value="06" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("06")?" selected":""%>>06</option>
							<option value="07" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("07")?" selected":""%>>07</option>
							<option value="08" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("08")?" selected":""%>>08</option>
							<option value="08" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("09")?" selected":""%>>09</option>
							<option value="10" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("10")?" selected":""%>>10</option>
							<option value="11" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("11")?" selected":""%>>11</option>
							<option value="12" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("12")?" selected":""%>>12</option>
							<option value="13" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("13")?" selected":""%>>13</option>
							<option value="14" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("14")?" selected":""%>>14</option>
							<option value="15" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("15")?" selected":""%>>15</option>
							<option value="16" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("16")?" selected":""%>>16</option>
							<option value="17" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("17")?" selected":""%>>17</option>
							<option value="18" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("18")?" selected":""%>>18</option>
							<option value="19" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("19")?" selected":""%>>19</option>
							<option value="20" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("20")?" selected":""%>>20</option>
							<option value="21" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("21")?" selected":""%>>21</option>
							<option value="22" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("22")?" selected":""%>>22</option>
							<option value="23" <%=sfmc_TB_OPTION.getEndTime().substring(0, 2).equals("23")?" selected":""%>>23</option>
						</select>시
						<select class="autoW" name="endTime2">
							<option value="00" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("00")?" selected":""%>>00</option>
							<option value="05" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("05")?" selected":""%>>05</option>
							<option value="10" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("10")?" selected":""%>>10</option>
							<option value="15" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("15")?" selected":""%>>15</option>
							<option value="20" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("20")?" selected":""%>>20</option>
							<option value="25" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("25")?" selected":""%>>25</option>
							<option value="30" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("30")?" selected":""%>>30</option>
							<option value="35" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("35")?" selected":""%>>35</option>
							<option value="40" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("40")?" selected":""%>>40</option>
							<option value="45" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("45")?" selected":""%>>45</option>
							<option value="50" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("50")?" selected":""%>>50</option>
							<option value="55" <%=sfmc_TB_OPTION.getEndTime().substring(2, 4).equals("55")?" selected":""%>>55</option>
						</select>분
					</td>
				</tr>
			</table>						
		</div>
		
		<h2>2주분 주문</h2>		
		<div class="wrap_tbl_inner marginT5">	
			<table class="tbl_inner">	
				<colgroup>
					<col width="45px">
					<col width="100px">
					<col width="50px">
					<col>
				</colgroup>
				<tr>
					<td colspan="4">
						<input type="checkbox" name="CheckLongWeekend" value = "1" <%=sfmc_TB_OPTION.getCheckLongWeekend().equals("1")?"checked":""%>>2주분 주문 설정
					</td>
				</tr>
				<tr>
					<th>시작일</th>
					<td>
						<input class="easyui-datebox" data-options="formatter:myformatter,parser:myparser" name="StartLongWeekend" value="<%=sfmc_TB_OPTION.getStartLongWeekend()%>"></input>
					</td>
					<th>종료일</th>
					<td>
					    <input class="easyui-datebox" data-options="formatter:myformatter,parser:myparser" name="EndLongWeekend" value="<%=sfmc_TB_OPTION.getEndLongWeekend()%>"></input>
					</td>
				</tr>
			</table>						
		</div>
		
		
		<div class="btn_area">
			<a href="javascript:saveData();" class="easyui-linkbutton">저장</a>
		</div>
		
	</div>

	<div data-options="region:'south',border:false" class="layout_south alignL">
		Copyright 2013 Suwon City Facilities Management Corporation. All rights reserved.
		<p class="btn_close" title="닫기" onclick="window.close()"></p>
	</div>
	</form>	
	
	
</body>

<script type="text/javascript">
//캘린더
function myformatter(date){
    var y = date.getFullYear();
    var m = date.getMonth()+1;
    var d = date.getDate();
    return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function myparser(s){
    if (!s) return new Date();
    var ss = (s.split('-'));
    var y = parseInt(ss[0],10);
    var m = parseInt(ss[1],10);
    var d = parseInt(ss[2],10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
        return new Date(y,m-1,d);
    } else {
        return new Date();
    }
}
</script>
</html>